package com.ctgu.expresshelper.controller;


import com.ctgu.expresshelper.entity.Shop;
import com.ctgu.expresshelper.service.Shop.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/shop")
public class ShopController {
    @Autowired
    private ShopService shopService;

    /**
     * 得到所有商店信息
     * @return
     */
    @GetMapping("/getAllShop")
    public List<Shop> getAllShop(){
        return shopService.getAllShop();
    }

    /**
     * 更具id查询商店信息
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Shop selectShopById(@PathVariable int id){
        return shopService.selectShopById(id);
    }
}
